<?php echo $header ?>
<?php echo $slider ?>
<div class="content">
    <div class="container">
        <div class="row">
            <div class="span8">
                <?php 
                foreach ($estates as $key => $item) {
                    $mainPhoto  = base_url() . "uploads/" . $item->photo;
                    $thumbPhoto = base_url() . "uploads/thumbs/" . $item->photo;
                    ?>
                    <script>
                        $(document).ready(function() {
                            $(".lightbox<?php echo $key ?>").colorbox({rel: 'lightbox<?php echo $key ?>', slideshow: true, scalePhotos: true, maxHeight: "100%"});
                        });
                    </script>
                    <div class="home-tab-main">
                        <div class="row">
                            <div class="span8">
                                <h4>
                                    <strong><a href="<?php echo site_url() . "single/" . $item->id ?>"><?php echo $item->title ?></a></strong>
                                    <p class="pull-right count-title"><?php echo number_format($item->price, 0, '.', ',') . lang('content_price_sembol'); ?></p>
                                </h4>
                            </div>
                        </div>

                        <div class="row">
                            <div class="span2">
                                <a href="<?php echo $mainPhoto ?>" class="thumbnail lightbox<?php echo $key ?>"><img src="<?php echo (@getimagesize($mainPhoto)) ? $thumbPhoto : base_url() . "assets/theme/images/default.png" ?>"  alt=""/></a>
                            </div>
                            <div class="span6">
                                <div class="tabbable tabs-left">
                                    <ul class="nav nav-tabs">
                                        <li class="active"><a href="#A<?php echo $key ?>" data-toggle="tab"><?php echo lang('content_estate_images') ?></a></li>
                                        <li><a href="#B<?php echo $key ?>" data-toggle="tab"><?php echo lang('content_estate_property') ?></a></li>
                                        <li><a href="#C<?php echo $key ?>" data-toggle="tab"><i class="icon-info-sign"></i><?php echo lang('content_estate_contact') ?></a></li>
                                    </ul>
                                    <div class="tab-content home-tab">
                                        <div class="tab-pane active" id="A<?php echo $key ?>">
                                            <p>
                                                <span class="label label-success" ><i class="icon-signal" style="margin-right:3px;"></i><?php echo $item->catName ?></span>
                                                <span class="label label-info" ><?php echo $item->squaremeter . " m<sup>2</sup>" ?></span> 
                                                <span class="badge badge-success pull-right count"><?php echo number_format($item->price, 0, '.', ',') . lang('content_price_sembol'); ?></span>
                                            </p>  
                                            <?php $photos = json_decode($item->photoGallery); ?>
                                            <?php foreach ($photos as $photo) { ?>
                                                <?php
                                                $file       = base_url() . "uploads/" . $photo;
                                                $filethumb  = base_url() . "uploads/thumbs/" . $photo;
                                                if (!@getimagesize($file)) {
                                                    break;
                                                }
                                                ?>
                                                <a href="<?php echo $file ?>" class="lightbox<?php echo $key ?>"><img src="<?php echo (@getimagesize($filethumb)) ? $filethumb : base_url() . "assets/theme/images/default.png" ?>"  alt=""/></a>
                                            <?php } ?>
                                        </div>
                                        <div class="tab-pane" id="B<?php echo $key ?>">
                                            <p>
                                                <span class="label label-success" ><i class="icon-signal" style="margin-right:3px;"></i><?php echo $item->catName ?></span>
                                                <span class="label label-info" ><?php echo $item->squaremeter . " m<sup>2</sup>" ?></span> 
                                                <span class="badge badge-success pull-right count"><?php echo number_format($item->price, 0, '.', ',') . lang('content_price_sembol'); ?></span>
                                            </p>                                
                                            <table class="estateprop">
                                                <tr>
                                                    <td class="one"><?php echo lang('content_heating') ?></td>
                                                    <td class="td"><?php echo $item->heating ?></td>
                                                    <td class="two"><?php echo lang('content_bathroom') ?></td>
                                                    <td><?php echo $item->bathroom ?></td>
                                                </tr>
                                                <tr>
                                                    <td class="one"><?php echo lang('content_buildstatus') ?></td>
                                                    <td class="td"><?php echo $item->buildstatus ?></td>
                                                    <td class="two"><?php echo lang('content_room') ?></td>
                                                    <td><?php echo $item->room ?></td>
                                                </tr>
                                                <tr>
                                                    <td class="one"><?php echo lang('content_estate_type') ?></td>
                                                    <td class="td"><?php echo $item->estateName ?></td>
                                                    <td class="two"><?php echo lang('content_estate_floor') ?></td>
                                                    <td><?php echo $item->floor ?></td>

                                                </tr>
                                            </table>
                                        </div>
                                        <div class="tab-pane" id="C<?php echo $key ?>">
                                            <p>
                                                <span class="label label-success" ><i class="icon-signal" style="margin-right:3px;"></i><?php echo $item->catName ?></span>
                                                <span class="label label-info" ><?php echo $item->squaremeter . " m<sup>2</sup>" ?></span> 
                                                <span class="badge badge-success pull-right count"><?php echo number_format($item->price, 0, '.', ',') . lang('content_price_sembol'); ?></span>
                                            </p>                       
                                            <table class="estateprop">
                                                <tr>
                                                    <td class="one"><?php echo lang('content_phone') ?></td>
                                                    <td class="td"><?php echo $item->telephone ?></td>
                                                </tr>
                                                <tr>
                                                    <td class="one"><?php echo lang('content_mobile_phone') ?></td>
                                                    <td class="td"><?php echo $item->gsm ?></td>
                                                </tr>
                                                <tr>
                                                    <td class="one"><?php echo lang('content_email') ?></td>
                                                    <td class="td"><?php echo $item->email ?></td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </div> <!-- /tabbable -->
                            </div> <!-- /span6 -->
                        </div> <!-- /row -->

                        <div class="row">
                            <div class="span8" style="margin-bottom:0px;">
                                <p>
                                    <?php echo date('d F Y', strtotime($item->addedDate)) ?>
                                    <a href="<?php echo site_url() . "single/" . $item->id ?>" class="btn btn-info pull-right"><?php echo lang('content_details_btn') ?></a>
                                </p>
                            </div>
                        </div> <!-- /row -->
                    </div> <!-- /home-tab-main -->
                <?php } ?>
                <?php echo $pagination ?>
            </div> <!-- /span8 -->

            <div class="span4 sidebar">
                <?php echo $sidebar ?>
            </div>
            
        </div>
        
    </div>
</div>


<?php echo $footer ?>